<template>
  <div>
    <button @click="isShow=!isShow">显示/隐藏</button>
    <transition name="hello1">
      <h1 v-show="isShow">你好啊</h1>
    </transition>
    <br>
    <transition name="hello2">
      <h1 v-show="isShow">你好啊</h1>
    </transition>
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
  }
  button{
    font-size: 40px;
  }
  h1 {
    background-color: orange;
    font-size: 60px;
  }
  @keyframes atguigu {
    from{
      transform: translateX(0);
    }
    to{
      transform: translateX(-100%);
    }
  }
  @keyframes atguigu2 {
    from{
      transform: translateX(0);
    }
    to{
      transform: translateX(100%);
    }
  }
  .hello1-leave-active {
    animation: atguigu 1s linear;
  }
  .hello1-enter-active {
    animation: atguigu 1s linear reverse;
  }
  .hello2-leave-active {
    animation: atguigu2 1s linear;
  }
  .hello2-enter-active {
    animation: atguigu2 1s linear reverse;
  }
</style>